import { Search } from "@nutui/icons-react-taro";
import styles from "./index.scss";
import { ConfigProvider, SearchBar } from "@nutui/nutui-react-taro";
import { useState } from "react";
import { Text } from "@tarojs/components";

export default ({ onSearch,...rest }: any ) => {
  const [value,setValue] = useState();
  return (
    <ConfigProvider
      theme={{
        nutuiSearchbarBackground: "#fff",
        nutuiSearchbarInputBackground: "#fff",
        nutuiSearchbarInputTextAlign: "left",
      }}
    >
      <SearchBar  {...rest} value={value} onChange={(e) => setValue(e)} onClear={() => setValue("")} leftIn={null} left={<Text onClick={()=>onSearch(value)} >搜索</Text>} className={styles.searchBar} />
    </ConfigProvider>
  );
};
